package com.zpz.framework.zpzoauth.web;

import com.github.pagehelper.PageInfo;
import com.zpz.framework.zpzoauth.common.result.ZpzOauthResultMsg;
import com.zpz.framework.zpzoauth.pojo.vo.GetDepartmentPageVo;
import com.zpz.framework.zpzoauth.service.ZpzOauthFrameDepartmentService;
import com.zpz.framework.zpzoauth.pojo.qo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author zhangpanzhi
 * @description 部门管理
 * @create 2019-07-04 16:11
 */
@Api(tags = "部门管理")
@RestController
@RequestMapping(value = "/department")
public class ZpzOauthDepartmentController {
    @Resource
    private ZpzOauthFrameDepartmentService zpzOauthFrameDepartmentService;

    @ApiOperation(value = "获取部门列表（100058） |负责人：张盼枝",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getDepartmentPageQo", value = "参数", paramType = "body", dataType = "GetDepartmentPageQo", required = true
            )})
    @PostMapping(value = "/getDepartmentPage")
    public ZpzOauthResultMsg<PageInfo<GetDepartmentPageVo>> getDepartmentPage(HttpServletRequest request, @RequestBody GetDepartmentPageQo getDepartmentPageQo) throws Exception{
        return zpzOauthFrameDepartmentService.getDepartmentPage(getDepartmentPageQo);
    }
    @ApiOperation(value = "获取部门详情（100059） |负责人：张盼枝",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "getDepartmentInfoQo", value = "参数", paramType = "body", dataType = "GetDepartmentInfoQo", required = true
            )})
    @PostMapping(value = "/getDepartmentInfo")
    public ZpzOauthResultMsg<GetDepartmentPageVo> getDepartmentInfo(HttpServletRequest request, @RequestBody GetDepartmentInfoQo getDepartmentInfoQo) throws Exception{
        return zpzOauthFrameDepartmentService.getDepartmentInfo(getDepartmentInfoQo);
    }
    @ApiOperation(value = "新增部门（100060） |负责人：张盼枝",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "addDepartmentQo", value = "参数", paramType = "body", dataType = "AddDepartmentQo", required = true
            )})
    @PostMapping(value = "/addDepartment")
    public ZpzOauthResultMsg<Boolean> addDepartment(HttpServletRequest request, @RequestBody AddDepartmentQo addDepartmentQo) throws Exception{
        return zpzOauthFrameDepartmentService.addDepartment(addDepartmentQo);
    }
    @ApiOperation(value = "禁用启用部门（100061） |负责人：张盼枝",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "disableDepartmentQo", value = "参数", paramType = "body", dataType = "DisableDepartmentQo", required = true
            )})
    @PostMapping(value = "/disableDepartment")
    public ZpzOauthResultMsg<Boolean> disableDepartment(HttpServletRequest request, @RequestBody DisableDepartmentQo disableDepartmentQo) throws Exception{
        return zpzOauthFrameDepartmentService.disableDepartment(disableDepartmentQo);
    }
    @ApiOperation(value = "删除部门（100062） |负责人：张盼枝",
            notes = "  \n 数据安全：无," +
                    "  \n返回码：0（OK），")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "removeDepartmentQo", value = "参数", paramType = "body", dataType = "RemoveDepartmentQo", required = true
            )})
    @PostMapping(value = "/removeDepartment")
    public ZpzOauthResultMsg<Boolean> removeDepartment(HttpServletRequest request, @RequestBody RemoveDepartmentQo removeDepartmentQo) throws Exception{
        return zpzOauthFrameDepartmentService.removeDepartment(removeDepartmentQo);
    }

}
